﻿using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
using Quartz;
using Quartz.Impl;
using log4net;

namespace WebSite
{
    public class MvcApplication : System.Web.HttpApplication
    {
        ILog log = LogManager.GetLogger("SpiderLoger"); 
        IScheduler sche = null;
        protected void Application_Start()
        {
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            log4net.Config.XmlConfigurator.Configure();
            ISchedulerFactory fac = new StdSchedulerFactory();
            sche = fac.GetScheduler();
            sche.Start();
        }
        protected void Application_End()
        {
            sche.Shutdown(true);
            log.Info("Application End");
        }
    }
}